<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Vue basic</title>
  <script src="https://unpkg.com/vue@next"></script>
</head>

<body>
<div id="app">
  <p ref="foo">获取DOM</p>
</div>
</div>
<script>
  const { createApp, ref, onMounted } = Vue;
  const App = {
    setup() {
      const foo = ref(null);

      onMounted(() => {
        // 初始渲染后，DOM 元素将被分配给 ref
        // p.value 是原生 DOM 对象
        console.log(foo.value);
      });
      return {
        foo,
      };
    },
  };
  createApp(App).mount('#app');
</script>
</body>

</html>